package com.study.blog.handler;

import com.study.blog.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 1
 * @data 2022/2/15
 */
@ControllerAdvice//对加了controller注解的方法进行连接 Aop的实现
public class AllExceptionHandler {
    //进行异常处理处理Exception.class的异常
    @ExceptionHandler(Exception.class)
    @ResponseBody//返回页面
    public Result doException(Exception e) {
        e.printStackTrace();
        return Result.fail(-999,"系统异常！！");

    }
}
